﻿cmake_minimum_required(VERSION 3.10)  #cmake版本最低3.10

set(CMAKE_CXX_STANDARD 11) #设置C++标准

set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")

project(HighConcurrency)

# 查找 src 目录下的源文件
file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.h")

# 添加可执行文件
add_executable(${PROJECT_NAME})

# 包含头文件目录
target_include_directories(${PROJECT_NAME} PRIVATE 
    ${CMAKE_CURRENT_SOURCE_DIR}/src
)

target_sources(${PROJECT_NAME} PRIVATE 
    ${HEADERS}
    ${CMAKE_CURRENT_SOURCE_DIR}/src/common.cpp                  # 存放freeList, spanList的定义
    ${CMAKE_CURRENT_SOURCE_DIR}/src/concurrentalloc.cpp         # 封装好的申请和释放内存接口
    
    ${CMAKE_CURRENT_SOURCE_DIR}/src/threadcache.cpp             
    ${CMAKE_CURRENT_SOURCE_DIR}/src/centralcache.cpp            
    ${CMAKE_CURRENT_SOURCE_DIR}/src/pagecache.cpp

    # test code
    ${CMAKE_CURRENT_SOURCE_DIR}/src/benchmark_test.cpp          # 测试性能
    ${CMAKE_CURRENT_SOURCE_DIR}/src/unit_test.cpp              # 测试整个申请释放流程
)